package com.charon.common.interceptor;

import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;

/**
 * 暂时没用
 * ResponseBody注解拦截器
 * @author Administrator
 *
 */
@ControllerAdvice
public class ResponseBodyResult implements ResponseBodyAdvice<Object> {

	@Override
	public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, Class aClass,
			ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
		//此处可以拦截ResponseBody注解的返回值
		//System.out.println("返回值：" + o.toString() + "," + methodParameter);
		return o;
	}

	@Override
	public boolean supports(MethodParameter methodParameter, Class aClass) {
		return true;
	}
}
